package com.oig.sys.base.dao;

import com.oig.sys.base.entity.TbCurrency;
import com.oig.sys.base.vo.CurrencyVo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
@author wuxl
*/
public interface ITbCurrencyDao extends JpaRepository<TbCurrency, String> {


	@Query("from TbCurrency c where c.code=:code")
	TbCurrency getByCode(@Param("code") String code);

	@Query("select new com.oig.sys.base.vo.CurrencyVo(c.code,c.name,c.enName,c.status,c.pricePrecision,c.amountPrecision,c.symbol) " +
			"from TbCurrency c where c.status=:status")
	List<CurrencyVo> findAllForVo(@Param("status") String status);
}
